-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Show primary story description and headline in autodocs #20604
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍
code/lib/preview-api/src/modules/preview-web/PreviewWeb.test.ts
Outdated
Show resolved
Hide resolved
Ok, now this is ready for re-review. Sorry for the early review @JReinhold. I changed the name and added a test for the "initial" behaviour. I wasn't sure if we wanted to add stories for the |
a8d6012
to
aaeeb1a
Compare
@JReinhold so the e2e test is failing due to this query:
I guess that's because the
What shall we do about this do you think? |
I think the primary story should have a special ID. not sure what though. Not sure what though ( |
Ok, that makes sense. I did that. |
@valentinpalkovic the failure on this branch comes from the angular renderer which doesn't appear to be able to render the same story more than once on the screen: Is that surprising to you? If it's expected would it be easy to change/fix? |
Fixed in #20559 :) |
Oh amazing! |
Are you sure about that Valentin? The issue you and I discussed a few days ago, was about Angular being unable to render any multiple stories twice, like it does in docs. But this here is specifically about rendering the same story twice. Maybe you've already taken care of this since our last conversation, then please ignore me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
Angular components are rendered as Standalone components in https://github.com/storybookjs/storybook/pulls. Therefore, the same component can be rendered multiple times without any issues. |
Co-authored-by: Jeppe Reinhold <[email protected]>
…into add-ignoreArgsUpdates
I changed the base of this #20559, let's find out for sure! |
@tmeasday Hmm. Still, it does not work. let me take a quick look. Shouldn't be that hard to fix. |
In my opinion, The Main Story, Default or Playground should be generated as the Base Story from the component definition only ( with default values ) and be independent of all Stories. I used the same technique in most Storybook projects so the Playground on where you mix and match different states of your component, and mostly the following stories are complete illustrations of Variants so the user can see a max of the component's states. i have been raising some issues since the update. |
I don't disagree with you, but in the current data model I don't think that's possible. There's no such thing as displaying a story only based on the meta information, only actual stories can be displayed. And what would you expect to be shown with the following stories file? export default {
title: 'My Button'
}
export const Primary = {
render: () => <button>hello</button>
} Without a |
@tmeasday hello! What is the motivation of changing the default value of |
I believe you can get back the old behavior by providing your own custom https://storybook.js.org/docs/7.0/react/writing-docs/docs-page#write-a-custom-template // .storybook/preview.jsx
import React from 'react';
import { Title, Subtitle, Description, Primary, Controls, Stories } from '@storybook/blocks';
export const parameters = {
...
docs: {
page: () => (
<>
<Title />
<Subtitle />
<Description />
<Primary />
<Controls />
<Stories includePrimary={false} />
</>
);
},
}; Do you have a specific use-case that requires the primary story to be hidden from the list of stories? |
Ok. We use Angular, I can see that I should dig around |
@JReinhold I played with custom Docs template and it worked like a charm. Thank you! |
Issue: N/A
Telescoping on #20559
What I did
Added a render option
forceInitialArgs
which means a story is rendered with it's initial args no matter what and doesn't respond to arg updates. Use this in the<Stories/>
block, and switch to showing the primary story there.The idea is that now in Autodocs we show:
How to test